package cn.tedu.micro.demo.device.controller;

import cn.tedu.micro.demo.common.protocol.JsonResult;
import cn.tedu.micro.demo.common.vo.GunInfoVO;
import cn.tedu.micro.demo.device.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DeviceController {
    @Autowired
    private DeviceService deviceService;
    /**
     * Get
     * /device/gun/info/{gunId}
     * JsonResult<GunInfoVO>
     */
    @GetMapping("/device/gun/info/{gunId}")
    public JsonResult<GunInfoVO> getGunInfo(@PathVariable(value = "gunId") Integer gunId){
        //控制层要返回什么数据,要求业务层返回什么什么数据
        GunInfoVO vo=deviceService.getGunInfo(gunId);
        return JsonResult.ok("ok",vo);
    }
    /*@GetMapping("/test")
    public String test(){
        return "nihao";
    }*/
}
